<?php

namespace app\model;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

class LanderService extends Base
{

    protected $table = "lander_service";


    protected $connection;


    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->connection = config('database.connections.biqi_game.database');
    }

    public function ParentLanderServiceGroup(): BelongsTo
    {
        return $this->belongsTo(LanderServiceGroup::class, 'parent_ulid', 'ulid');
    }


    public function Server(): BelongsTo
    {
        return $this->belongsTo(Server::class, 'server', 'ulid')->where('state', 1);
    }


    public function DistrictService(): BelongsTo
    {
        return $this->belongsTo(DistrictService::class, 'district_service', 'ulid')->whereIn("state", [0, 1, 2]);
    }

}